function searchBox() {

    var input = $('input#s');
    var divInput = $('div.input');
    var width = divInput.width();
    var outerWidth = divInput.parent().width() - (divInput.outerWidth() - width) - 28;
    var submit = $('#searchSubmit');
    var txt = input.val();

    input.bind('focus', function () {
        if (input.val() === txt) {
            input.val('');
        }
        $(this).animate({ color: '#446' }, 300); // text color
        $(this).parent().animate({
            width: outerWidth + 'px',
            backgroundColor: '#ebf0ff', // background color
            paddingRight: '15px'
        }, 300, function () {
            if (!(input.val() === '' || input.val() === txt)) {
                if (!($.browser.msie && $.browser.version < 9)) {
                    submit.fadeIn(300);
                } else {
                    submit.css({ display: 'block' });
                }
            }
        }).addClass('focus');
    }).bind('blur', function () {
        $(this).animate({ color: '#b4bdc4' }, 300); // text color
        $(this).parent().animate({
            width: width + 'px',
            backgroundColor: '#e8edf1', // background color
            paddingRight: '15px'
        }, 300, function () {
            if (input.val() === '') {
                input.val(txt)
            }
        }).removeClass('focus');
        if (!($.browser.msie && $.browser.version < 9)) {
            submit.fadeOut(100);
        } else {
            submit.css({ display: 'none' });
        }
    }).keyup(function () {
        if (input.val() === '') {
            if (!($.browser.msie && $.browser.version < 9)) {
                submit.fadeOut(300);
            } else {
                submit.css({ display: 'none' });
            }
        } else {
            if (!($.browser.msie && $.browser.version < 9)) {
                submit.fadeIn(300);
            } else {
                submit.css({ display: 'block' });
            }
        }
    });

    // quicksearch
    $('div#searchForm').submit(function (e) {
        e.preventDefault();

        // hide search form
        $('ul#Search li').empty();

        var $input = $('input#s').attr('value');
        var $tags = $input.split(' ');

        get_links('featured', 'Search', $tags, '', '0', '1');
        
        //selecionar a tab search
    });

    

}

function searchForm() {

    $('div#searchfull').submit(function (e) {

        alert('search form');
        e.preventDefault();

        var $clone = $('div#searchfull').clone();


        var $users;
        var $input = $('input#s0').attr('value');
        if ($input != "")
            $users = $input.split(' ');
        else ($users = $input);

        var $tags;
        $input = $('input#s1').attr('value');
        if ($input != "")
            $tags = $input.split(' ');
        else $tags = $input;


        var $order = $("input[@name=order-group]:checked").val();
        var $exc = $("input[name=andor]:checked").val();

        console.log($order);
        console.log($tags);
        console.log($users);
        console.log('exc: ' + $exc);

        $('ul#Search').empty();
        $('ul#Search').append($clone);
        searchForm();
        get_links($order, 'Search', $tags, $users, $exc, '1');
        
    }); 

}

